﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using mscook.core.domain;
using mscook.core.repositories;

namespace mscook.core.services
{
    public class LoginUserService : ILoginUserService
    {
        private ILoginUserRepository iLoginUserRepository;
        public LoginUserService(ILoginUserRepository iLoginUserRepository)
        {
            this.iLoginUserRepository = iLoginUserRepository;
        }

        #region ILoginUserService 成员

        void ILoginUserService.SaveOrUpdate(domain.LoginUser loginUser)
        {
            iLoginUserRepository.SaveOrUpdate(loginUser);
        }

        void ILoginUserService.Delete(string id)
        {
            iLoginUserRepository.Delete(id);
        }

        LoginUser ILoginUserService.Get(string id)
        {
            return iLoginUserRepository.Get(id);
        }

        LoginUser ILoginUserService.SelectLoginUserByLoginName(string loginName)
        {
            return iLoginUserRepository.SelectLoginUserByLoginName(loginName);
        }

        LoginUser ILoginUserService.SelectLoginUserByLoginNameOrEmail(string loginName, string email)
        {
            return iLoginUserRepository.SelectLoginUserByLoginNameOrEmail(loginName, email);
        }

        IList<LoginUser> ILoginUserService.SelectLimitLoginUserByType(bool isAnonymous, int start, int limit, out long total, System.Linq.Expressions.Expression<Func<LoginUser, bool>> expression)
        {
            return iLoginUserRepository.SelectLimitLoginUserByType(isAnonymous,start,limit,out total,expression);
        }

        IList<LoginUser> ILoginUserService.SelectLimitSystemUser(bool isVip, int start, int limit, out long total, System.Linq.Expressions.Expression<Func<LoginUser, bool>> expression)
        {
            return iLoginUserRepository.SelectLimitSystemUser(isVip,start,limit,out total,expression);
        }

        public LoginUser UserLogOnSelectByLoginNameOrEmail(string InputValue)
        {
            return iLoginUserRepository.UserLogOnSelectByLoginNameOrEmail(InputValue);
        }

        public bool ValidateLoginUserByPsd(string LoginName,string password)
        {
            return iLoginUserRepository.ValidateLoginUserByPsd(LoginName,password);
        }

        public bool IsNullByLoginNameOrEmail(string loginName, string email)
        {
            return iLoginUserRepository.IsNullByLoginNameOrEmail(loginName,email);
        }

        public bool IsNullByLoginName(string loginName)
        {
            return iLoginUserRepository.IsNullByLoginName(loginName);
        }
        public bool IsNullByEmail(string email)
        {
            return iLoginUserRepository.IsNullByEmail(email);
        }
        #endregion
    }
}
